package com.leetcode.题库;

/**
 * @author 覃国强
 * @date 2022-02-26 11:05
 */
public class 题库_2016_增量元素之间的最大差值 {

  static
  class Solution {
    public int maximumDifference(int[] nums) {
      int min = nums[0];
      int max = -1;
      for (int j = 1; j < nums.length; ++j) {
        if (nums[j] > min) {
          max = Math.max(max, nums[j] - min);
        } else {
          min = nums[j];
        }
      }
      return max;
    }
  }

}
